home *** CD-ROM | disk | FTP | other *** search
/ Disc to the Future 2 / Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin / MAC / THINKC / 5 / WINDOW_F / DRAW_ARR.C < prev    next >
C/C++ Source or Header  |  1992-07-19  |  795b  |  32 lines

  1. #include "Draw_arrow.h"
  2.  
  3. extern short    line_height;
  4.  
  5. void Draw_arrow( Rect *menu_rect, short scroll_sign )
  6. {
  7.     register short        max_dots, scan_h, scan_v, v_gap;
  8.     Rect            munge_rect;
  9.     
  10.     munge_rect = *menu_rect;
  11.     max_dots = line_height & 0xFFFE; // round down to an even number
  12.     scan_h = menu_rect->left + line_height;
  13.     v_gap = (line_height - (max_dots >> 1)) >> 1;
  14.     if (scroll_sign > 0)    // scroll triangle at bottom
  15.     {
  16.         munge_rect.top = munge_rect.bottom - line_height;
  17.         scan_v = munge_rect.top + v_gap;
  18.     }
  19.     else                    // scroll triangle at top
  20.     {
  21.         munge_rect.bottom = munge_rect.top + line_height;
  22.         scan_v = munge_rect.bottom - v_gap;
  23.     }
  24.     EraseRect( &munge_rect );
  25.     MoveTo( scan_h, scan_v );
  26.     while (max_dots >= 0)
  27.     {
  28.         Line( max_dots, 0 );
  29.         Move( 1-max_dots, scroll_sign );
  30.         max_dots -= 2;
  31.     }
  32. }